Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: Fix possibly indexing None in psmap.utils.convertRGB #4875

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

echoix
Copy link
Member

@echoix echoix commented Dec 23, 2024

Fully type check and annotate convertRGB() and the grass.script.core.parse_color() functions

The psmap.utils.convertRGB is in fact two separate functions, that takes two different kinds of inputs and outputs the other kind. It is correctly represented with an overload.

All places where grass.script.core.parse_color() was used were checked, and it was only here. The generator inside the tuple constructor was changed to a fixed size tuple literal, in order to have simpler signature than tuple[float, float, float] | tuple[float, ...] | None, where the tuple[float, ...] is for tuples of float of unknown length, which had an impact on static analysis in convertRGB.

I needed to wait for #4873 to be merged to avoid conflicts, they were successive commits in my pylint 3 working branch.

Fully type check and annotate convertRGB() and the grass.script.core.parse_color() functions
@echoix echoix requested a review from ninsbl December 23, 2024 14:43
@github-actions github-actions bot added GUI wxGUI related Python Related code is in Python libraries labels Dec 23, 2024
@echoix echoix enabled auto-merge (squash) December 23, 2024 15:20
@echoix echoix merged commit 57a646b into OSGeo:main Dec 23, 2024
26 checks passed
@echoix echoix deleted the gui-convertRGB branch December 23, 2024 15:54
@github-actions github-actions bot added this to the 8.5.0 milestone Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI wxGUI related libraries Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants